home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Mac OS 8.5 Updaters / RealPC⁄Soft Windows / RealPC / RealPC Upgrade Disk / SWUPDATE.BAT < prev    next >
Encoding:
DOS Batch File  |  1998-08-24  |  14.3 KB  |  407 lines

  1. @echo off
  2. @if not "%8" == "" echo %8
  3. rem [
  4. rem    Name:        u.swupdate.bat
  5. rem
  6. rem    Derived from:    (original)
  7. rem
  8. rem    Author:        David Lillie
  9. rem
  10. rem    Created on:    Sep 1996
  11. rem
  12. rem    Sccs ID:    @(#)u.swupdate.bat    1.52 02/01/98
  13. rem
  14. rem    Coding Stds:    
  15. rem
  16. rem    Purpose:    To upgrade a SoftWindows hard disk container file.
  17. rem            This is called automatically.
  18. rem
  19. rem    Parameters:    1    host OS type i.e. "mac" or "unix"
  20. rem            2    new serial number (8 hex digits)
  21. rem            3    old serial number (8 hex digits)
  22. rem            4    Host System name
  23. rem            5    Host System release
  24. rem            6    Host System version
  25. rem            7    Host System hardware type
  26. rem            8    On/Off argument for echo
  27. rem            9    Drive letter for "WIN95" setup directory.
  28. rem
  29. rem    Copyright 1997 Insignia Solutions PLC. All rights reserved.
  30. rem ]
  31.  
  32.  
  33. rem Set path to upgrade utils (for an automatic upgrade)
  34. if exist d:\insignia\ibatch.exe path d:\;d:\insignia;%path%
  35.  
  36. rem Check to see if we have a valid first parameter
  37. if "%1"=="" goto manstamp
  38. rem Set up host OS environment variable
  39. ibatch swupdate_host tolower %1
  40. if "%swupdate_host%"=="unix" goto CheckSerial
  41. if "%swupdate_host%"=="mac" goto CheckSerial
  42. goto manstamp
  43.  
  44. :CheckSerial
  45. rem Check that we have the right number of parameters
  46. if "%9"=="" goto manstamp
  47.  
  48.  
  49. rem  Determine whether this is a newly-installed Intel OS
  50. set OSIsNew=0
  51. ibatch swupdate_NewOS = 0x%2 & 0xF000 #lx
  52. ibatch swupdate_OldOS = 0x%3 & 0xF000 #lx
  53. itest 0x%3 ">=" 0xF0000000
  54. if errorlevel 1 itest "%swupdate_OldOS%" "!=" "%swupdate_NewOS%"
  55. if errorlevel 1 set OSIsNew=1
  56.  
  57.  
  58. rem  Make copy of serial number which we might modify
  59. set new_sn=%2
  60.  
  61. rem Get language code from serial number.
  62. ibatch langNO string "%new_sn%" 2 2
  63. ibatch langNO tolower "%langNO%"
  64.  
  65. rem Determine which language extension to use
  66. call dec_lang langID %langNO%
  67. if not "%langID%" == "" goto GotLang
  68.  
  69. rem  Unknown language in requested serial number.
  70. rem  Try to detect the language from the hard disk.
  71. call findlang langNO
  72.  
  73. rem  Insert the language code into the serial number
  74. ibatch sn_head string "%new_sn%" 0 2
  75. ibatch sn_tail string "%new_sn%" 4 4
  76. set new_sn=%sn_head%%langNO%%sn_tail%
  77. set sn_head=
  78. set sn_tail=
  79.  
  80. call dec_lang langID %langNO%
  81. if not "%langID%" == "" goto GotLang
  82.  
  83. echo Unrecognised language on drive C:
  84. pause
  85. goto reboot
  86.  
  87. :GotLang
  88.  
  89. rem  Ensure we have 'our' directory.
  90. if not exist c:\insignia\nul md c:\insignia
  91.  
  92. rem  If there is no upgrade history, extract what we can from
  93. rem  the last upgrade log (if there was one).
  94. rem  We are interested in the two top batch files and the serial numbers of
  95. rem  the disks (searching for "-" finds the serial nos independent of language).
  96. if exist c:\insignia\uphist.log goto nonewhist
  97. if not exist c:\insignia\up.log goto nonewhist
  98. find /i /n "swupdate" c:\insignia\up.log >> c:\insignia\uphist.log
  99. find /i /n "w95once"  c:\insignia\up.log >> c:\insignia\uphist.log
  100. find /i /n "-"        c:\insignia\up.log >> c:\insignia\uphist.log
  101. :nonewhist
  102.  
  103. rem  Create log file afresh for each upgrade. Append to the history file.
  104. echo %0 %1 %2 %3 %4 %5 %6 %7 %8 %9    > c:\insignia\up.log
  105. echo. | date                >>c:\insignia\up.log
  106. echo. | time                >>c:\insignia\up.log
  107. vol c:                    >>c:\insignia\up.log
  108. vol d:                    >>c:\insignia\up.log
  109. echo %0 %1 %2 %3 %4 %5 %6 %7 %8 %9    >>c:\insignia\uphist.log
  110. echo. | date                >>c:\insignia\uphist.log
  111. echo. | time                >>c:\insignia\uphist.log
  112. vol c:                    >>c:\insignia\uphist.log
  113. vol d:                    >>c:\insignia\uphist.log
  114.  
  115. rem  Get interesting part of old serial number in lower case.
  116. ibatch old_swinv string %3 0 2
  117. ibatch old_swinv tolower %old_swinv%
  118.  
  119.  
  120. if not "%swupdate_host%" == "unix" goto no_esave
  121.  
  122. rem    Load FSA drivers and save user's E: drive setup. We need to restore
  123. rem    it because "net use" changes the user's configuration.
  124. rem     We need to frig the DOS version for devlod on Windows 95 disks.
  125.  
  126. dosver 6 0  d:\insignia\devlod.com d:\insignia\host.sys >>c:\insignia\up.log
  127. fsadrive >>c:\insignia\up.log
  128. net use e: | ibatch swupdate_edir string 0 0
  129.  
  130. rem    Obtain selected keyboard defaults file if any.
  131. rem    We do this here because we need to re-use FSA drive E: later.
  132. rem    (Having bypassed config.sys, the effective LASTDRIVE is E:)
  133.  
  134. net use e: /d>>c:\insignia\up.log
  135. net use e: $SWINHOME/local>>c:\insignia\up.log
  136. copy d:\unixonly\keybdef.unx c:\insignia\keyboard.def                >>c:\insignia\up.log
  137. if exist e:\selected\keyboard.def copy e:\selected\keyboard.def c:\insignia    >>c:\insignia\up.log
  138. net use e: /d>>c:\insignia\up.log
  139.  
  140. :no_esave
  141.  
  142. rem Ensure that critical files are writable (we make some read-only)
  143. if exist c:\insignia\*.*        attrib -r c:\insignia\*.* /s
  144. if exist c:\windows\pif\suspend.pif    attrib -r c:\windows\pif\suspend.pif
  145.  
  146. rem  Copy this file to drive C for manual updates.
  147. copy d:\swupdate.bat c:\insignia        >>c:\insignia\up.log
  148.  
  149. if not exist c:\windows\system.ini goto dosonly
  150. rem Test for Windows 95
  151. if exist c:\windows\ios.ini goto rawwin95
  152. rem Test for Windows For Workgroups
  153. if exist c:\windows\clipsrv.exe goto rawwfw
  154. rem Test for Windows 3.11 (NB emm386.exe exists on G:\ and C:\windows in
  155. rem a split setup).
  156. if exist c:\windows\emm386.exe goto rawwin311
  157.  
  158. :dosonly
  159. set swupdate_os=dos
  160. set space_needed=5000
  161. checkspc %space_needed%
  162. if not errorlevel 1 goto no_space
  163.  
  164. echo Adding Insignia drivers to DOS on drive C: ...
  165.  
  166. rem Remove obsolete stuff
  167. call delfiles list c:\windows c:\windows\system %swupdate_os% %1 %OSIsNew%
  168.  
  169. rem Copy files.
  170. xcopy /y d:\insignia        c:\insignia    >>c:\insignia\up.log
  171. xcopy /y d:\%1only        c:\insignia    >>c:\insignia\up.log
  172. if not exist c:\nwclient\nul md    c:\nwclient    >>c:\insignia\up.log
  173. xcopy /s /y d:\nwclient        c:\nwclient    >>c:\insignia\up.log
  174. c:
  175. cd \insignia
  176.  
  177. rem Only overwrite config.sys and autoexec.bat if it is a clean (CD2) hard disk
  178. if not "%old_swinv%" == "f0" goto no_dosbatch
  179.  
  180. set dos_type=msdos
  181. if not exist c:\dos\find.exe goto no_find
  182. ver | find "PC DOS" >nul
  183. if not errorlevel 1 set dos_type=pcdos
  184. :no_find
  185.  
  186. call dosbatch %1 %langID% %dos_type%
  187. :no_dosbatch
  188.  
  189. rem call d:\%1.bat dos c:\windows\system %langID% %4 %5 %6 %7
  190. goto purestamp
  191.  
  192. :rawnowin
  193. echo No version of Windows installed on C:
  194. pause
  195. goto reboot
  196.  
  197. :rawwfw
  198. set swupdate_os=wfw311
  199. set swupdate_os_name=Windows for Workgroups 3.11
  200. goto win31_and_wfw
  201.  
  202. :rawwin311
  203. set swupdate_os=win311
  204. set swupdate_os_name=Windows 3.11
  205. :win31_and_wfw
  206.  
  207. if not "%swupdate_host%" == "unix" goto win31hdf
  208.  
  209. rem Detect split setup (the default for Unix Swin 2.0)
  210. rem    If user.exe is present in G:\ and absent from C:\windows\system then
  211. rem    this is a split setup. If it exists in both places then it means that
  212. rem    either win2c.bat has been run, or it was put there ad hoc; either way
  213. rem    it implies a hard disk only setup.
  214. rem    Because we have bypassed config.sys and autoexec.bat, we need to set up
  215. rem    FSA and find the fsa windows directory explicitly. Furthermore we are
  216. rem    constrained to drive E: because we cannot execute a LASTDRIVE command.
  217.  
  218. if exist c:\windows\system\user.exe goto win31hdf
  219. net use e: /d>>c:\insignia\up.log
  220. net use e: $SWINHOME/windows>>c:\insignia\up.log
  221.  
  222. if exist e:\user.exe goto win31fsa
  223. net use e: /d>>c:\insignia\up.log
  224. goto rawnowin
  225.  
  226. :win31hdf
  227. set space_needed=5000
  228. checkspc %space_needed%
  229. if not errorlevel 1 goto no_space
  230. echo Adding Insignia drivers to %swupdate_os_name% on drive C: ...
  231. set swupdate_windir=c:\windows
  232. set swupdate_sysdir=c:\windows\system
  233. goto win31both
  234.  
  235. :win31fsa
  236. set space_needed=4000
  237. checkspc %space_needed%
  238. if not errorlevel 1 goto no_space
  239. echo Adding Insignia drivers to %swupdate_os_name% on FSA drive $SWINHOME/windows ...
  240. set swupdate_windir=e:
  241. set swupdate_sysdir=e:
  242.  
  243. :win31both
  244.  
  245. rem Remove obsolete stuff
  246. call delfiles list %swupdate_windir% %swupdate_sysdir% %swupdate_os% %1 %OSIsNew%
  247.  
  248. rem Copy files.
  249. xcopy /y d:\insignia c:\insignia    >>c:\insignia\up.log
  250. xcopy /y d:\%1only   c:\insignia    >>c:\insignia\up.log
  251.  
  252. call copywinf d:\insignia\for_win    %swupdate_windir%    >>c:\insignia\up.log
  253. call copywinf d:\%1only\for_win        %swupdate_windir%    >>c:\insignia\up.log
  254. call copywinf d:\insignia\for_w31    %swupdate_windir%    >>c:\insignia\up.log
  255. call copywinf d:\%1only\for_w31        %swupdate_windir%    >>c:\insignia\up.log
  256. xcopy /y d:\insignia\for_win\system    %swupdate_sysdir%    >>c:\insignia\up.log
  257. xcopy /y d:\%1only\for_win\system     %swupdate_sysdir%    >>c:\insignia\up.log
  258. xcopy /y d:\insignia\for_w31\system    %swupdate_sysdir%    >>c:\insignia\up.log
  259. xcopy /y d:\%1only\for_w31\system    %swupdate_sysdir%    >>c:\insignia\up.log
  260. if not exist c:\nwclient\nul md        c:\nwclient        >>c:\insignia\up.log
  261. xcopy /s /y d:\nwclient            c:\nwclient        >>c:\insignia\up.log
  262. if exist d:\%langID%only\for_win\nul call copywinf d:\%langID%only\for_win %swupdate_windir% >>c:\insignia\up.log
  263. c:
  264. cd \insignia
  265.  
  266. rem Only overwrite config.sys and autoexec.bat if it is a clean (CD2) hard disk
  267. if "%old_swinv%" == "f0" call dosbatch %1 %langID% win31
  268.  
  269. call w31batch %swupdate_windir% %swupdate_sysdir% %swupdate_os% %1 %langID% %3
  270. call d:\%1.bat win31 %swupdate_sysdir% %langID% %4 %5 %6 %7
  271. if "%swupdate_host%" == "unix" net use e: /d>>c:\insignia\up.log
  272. goto purestamp
  273.  
  274. :rawwin95
  275. ver | find "4." | ibatch swupdate_os_name string 0 10
  276. ibatch swupdate_os string "%swupdate_os_name%" 8 2
  277. set swupdate_os=win%swupdate_os%
  278.  
  279. set space_needed=10000
  280. checkspc %space_needed%
  281. if not errorlevel 1 goto no_space
  282.  
  283. echo Adding Insignia drivers to %swupdate_os_name% ...
  284.  
  285. rem Remove obsolete stuff
  286. call delfiles list c:\windows c:\windows\system %swupdate_os% %1 %OSIsNew%
  287.  
  288. rem Copy files.
  289. xcopy /y d:\insignia        c:\insignia    >>c:\insignia\up.log
  290. xcopy /y d:\%1only        c:\insignia    >>c:\insignia\up.log
  291. xcopy /s /y d:\insignia\for_win    c:\windows    >>c:\insignia\up.log
  292. xcopy /s /y d:\%1only\for_win    c:\windows    >>c:\insignia\up.log
  293. xcopy /s /y d:\insignia\for_w95    c:\windows    >>c:\insignia\up.log
  294. xcopy /s /y d:\%1only\for_w95    c:\windows    >>c:\insignia\up.log
  295. if not exist c:\nwclient\nul md    c:\nwclient    >>c:\insignia\up.log
  296. xcopy /s /y d:\nwclient        c:\nwclient    >>c:\insignia\up.log
  297. if exist d:\%langID%only\for_win\nul xcopy /s /y d:\%langID%only\for_win c:\windows >>c:\insignia\up.log
  298. c:
  299. cd \insignia
  300.  
  301. rem Only overwrite config.sys and autoexec.bat if it is a clean (CD2) hard disk
  302. if "%old_swinv%" == "f0" call dosbatch %1 %langID% win95
  303.  
  304. call w95batch %swupdate_host% %new_sn% %3 %4 %5 %6 %7 %swupdate_os%
  305.  
  306. rem  Construct reg file to add the runonce entry and
  307. rem  repair the installation source path (BCN 5506).
  308. echo REGEDIT4>c:\insignia\runonce.reg
  309.  
  310. echo.>>c:\insignia\runonce.reg
  311. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]>>c:\insignia\runonce.reg
  312. echo "IS_Customize"="c:\\insignia\\w95once.bat %swupdate_host% %new_sn% %3 %4 %5 %6 %7 %8 %langID%">>c:\insignia\runonce.reg
  313.  
  314. set W95SourcePath=%9:\\%swupdate_os%
  315. ibatch W95SourcePath toupper "%W95SourcePath%"
  316. if not "%swupdate_host%" == "unix" goto no_unix95
  317. rem  On Unix SoftWindows95, setup files are optionally installed on
  318. rem  $SWINHOME/win95 (or $SWINHOME/win98) which is mounted on G:
  319. net use e: /d>>c:\insignia\up.log
  320. net use e: $SWINHOME>>c:\insignia\up.log
  321. if exist e:\%swupdate_os%\mini.cab set W95SourcePath=G:\\
  322. net use e: /d>>c:\insignia\up.log
  323. :no_unix95
  324. rem  The setup files may still be on disk, in which case we should use them.
  325. if exist c:\windows\options\cabs\mini.cab set W95SourcePath=C:\\WINDOWS\\OPTIONS\\CABS
  326.  
  327. echo.>>c:\insignia\runonce.reg
  328. echo [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup]>>c:\insignia\runonce.reg
  329. echo "SourcePath"="%W95SourcePath%">>c:\insignia\runonce.reg
  330. set W95SourcePath=
  331.  
  332. regedit c:\insignia\runonce.reg            >>c:\insignia\up.log
  333. echo.>>c:\insignia\up.log
  334.  
  335. rem  Set up likely paths for Windows 95 setup files.
  336. mruedit  d:\insignia\mrumod.spt        >>c:\insignia\up.log
  337.  
  338. rem  Early versions of SoftWindows95 1.0 reported the wrong PnP ID for the
  339. rem  Insignia ESDI controller. We patch the correct ID into the registry here,
  340. rem  to prevent Windows displaying a reboot prompt during the upgrade.
  341. set enum_key=HKEY_LOCAL_MACHINE\Enum
  342. set eb_esdi_key=[%enum_key%\BIOS\*ISL060A]
  343. regedit /e c:\insignia\temp.reg %enum_key%    >>c:\insignia\up.log
  344. type c:\insignia\temp.reg | find "%eb_esdi_key%" | ibatch found_key string 0 0
  345. if not "%found_key%" == "%eb_esdi_key%" regedit d:\ins_esdi.reg    >>c:\insignia\up.log
  346. echo.>>c:\insignia\up.log
  347. del c:\insignia\temp.reg    >>c:\insignia\up.log
  348.  
  349. call d:\%1.bat win95 c:\windows\system %langID% %4 %5 %6 %7
  350. goto purestamp
  351.  
  352. :purestamp
  353. echo Update complete.
  354. rem
  355. rem Restore user's FSA drive
  356. if not "%swupdate_edir%" == "" net use %swupdate_edir%>>c:\insignia\up.log
  357. rem
  358. rem Update disk version number
  359. rem
  360. debug <d:\upcode.inp d:\empty %new_sn% >nul
  361. goto reboot
  362.  
  363. :manstamp
  364. rem  swupdate has been activated manually
  365. rem Log the manual upgrade to the history file.
  366. echo Manual upgrade activated. OS=%1, Extra Parameters %2 %3 %4 %5 %6 %7 %8 %9 >>c:\insignia\uphist.log
  367.  
  368. rem
  369. rem Set the first two digits of serial number to F1 and reboot.
  370. rem This will force an upgrade with the correct parameters
  371. debug <c:\insignia\upman.inp >nul
  372. goto reboot
  373.  
  374. :reboot
  375. rem
  376. rem Restore user's FSA drive
  377. if not "%swupdate_edir%" == "" net use %swupdate_edir%>>c:\insignia\up.log
  378. rem
  379. rem Reboot
  380. rem
  381. debug <c:\insignia\reboot.inp >nul
  382. rem We should not get here, but if we do..
  383. goto End
  384.  
  385. :no_space
  386. cls
  387. set sn=%space_needed%
  388. echo **************************************************************************
  389. echo *                                                                        *
  390. echo *                              WARNING                                   *
  391. echo *                                                                        *
  392. echo * There is not enough free space on your C: drive to perform the         *
  393. echo * upgrade.  You need a minimum of %sn%000 bytes free.                    *
  394. echo *                                                                        *
  395. echo * To increase the available free space, either:                          *
  396. echo * delete any unwanted files and restart; or increase the size            *
  397. echo * of your C: drive as described in the product documentation.            *
  398. echo *                                                                        *
  399. echo **************************************************************************
  400. goto End
  401.  
  402. :End
  403. rem
  404. rem Restore user's FSA drive
  405. if not "%swupdate_edir%" == "" net use %swupdate_edir%>>c:\insignia\up.log
  406.  
  407.